package org.come.entity;

import java.math.BigDecimal;
import java.util.Map;

import org.come.until.JmSum;


/**
 * 角色背包物品bean
 * 
 * @author 叶豪芳
 * @date : 2017年11月27日 上午10:06:42
 */
public class Goodstable implements Cloneable {
	// 表ID
	private BigDecimal rgid;
	// 角色ID
	private BigDecimal role_id;
	// 物品ID
	private BigDecimal goodsid;
	// 物品名称
	private String goodsname;
	// 皮肤
	private String skin;
	// 物品类型
	private Long type;
	// 贵重
	private Long quality;
	// 物品功能
	private String value;
	// 物品说明
	private String instruction;
	// 物品的状态（0没使用，1表示使用了）
	private Integer status;
	// 使用次数
	private Integer usetime;
	//物品是否有加锁
	private int goodlock;
	//物品是否有时间锁
	private int goodTimeLock;
	//物品是否有时间锁
	private Long goodTimeLockDuration;
	// 摆摊自定义价格
//	private BigDecimal definePrice;

    // 强化值
    private Integer qhv;
    // 强化总数
    private Integer qht;

	private Map<BigDecimal,Goodstable> ewMap;// 精炼进度
	private int sbjljd;
	// 精炼进度
	private String fysh;

	/**
	 * 物品使用消耗
	 */
	public void goodxh(int i) {
		setUsetime(getUsetime()-i);
	}
	/**替换对象*/
	public void TH(Goodstable good){
		rgid=good.rgid;
		role_id=good.role_id;
		goodsid=good.goodsid;
		goodsname=good.goodsname;
		sbjljd=good.sbjljd;
		fysh=good.fysh;
		skin=good.skin;
		type=good.type;
		quality=good.quality;
		value=good.value;
		instruction=good.instruction;
		status=good.status;
		usetime=good.usetime;
		goodlock=good.goodlock;
	}
	public Goodstable(BigDecimal rgid, BigDecimal role_id, BigDecimal goodsid,
			String goodsname,int sbjljd,String fysh, String skin, Long type, Long quality,
			String value, String instruction, Integer status,
			Integer usetime) {
		super();
		this.rgid = rgid;
		this.role_id = role_id;
		this.goodsid = goodsid;
		this.goodsname = goodsname;
		this.sbjljd = sbjljd;
		this.fysh = fysh;
		this.skin = skin;
		this.type = type;
		this.quality = quality;
		this.value = value;
		this.instruction = instruction;
		this.status = status;
		setUsetime(usetime);
	}

	public Goodstable() {
		// TODO Auto-generated constructor stub
	}

	public BigDecimal getRole_id() {
		return role_id;
	}

	public void setRole_id(BigDecimal role_id) {
		this.role_id = role_id;
	}

	public BigDecimal getGoodsid() {
		return goodsid;
	}

	public void setGoodsid(BigDecimal goodsid) {
		this.goodsid = goodsid;
	}

	public String getGoodsname() {
		return goodsname;
	}

	public void setGoodsname(String goodsname) {
		this.goodsname = goodsname == null ? null : goodsname.trim();
	}

	public String getSkin() {
		return skin;
	}

	public void setSkin(String skin) {
		this.skin = skin;
	}

	public Long getType() {
		if (type==null) {
			type=(long) -1;
		}
		return type;
	}

	public void setType(Long type) {
		this.type = type;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value == null ? null : value.trim();
	}

	public String getInstruction() {
		return instruction;
	}

	public void setInstruction(String instruction) {
		this.instruction = instruction == null ? null : instruction.trim();
	}

	public Long getQuality() {
		if (quality == null) {
            quality = new Long(0);
        }
		return quality;
	}

	public void setQuality(Long quality) {
		this.quality = quality;
	}

	public Integer getStatus() {
		if (status==null) {
            status=0;
        }
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getUsetime() {
		if (usetime == null) {
            setUsetime(1);
        }
		return (int) JmSum.MZ(usetime);
	}
	public void setUsetime(Integer usetime) {
//		if (goodsid!=null&&goodsid.longValue()==80050) {
//			if (usetime>20) {
//				usetime=20;
//			}
//		}
		this.usetime = (int) JmSum.ZM(usetime);
	}
	
	public BigDecimal getRgid() {
		if (rgid != null) {
			return rgid;
		} else {
			return new BigDecimal(0);
		}
	}

	public void setRgid(BigDecimal rgid) {
		this.rgid = rgid;
	}

	public int getGoodlock() {
		return goodlock;
	}
	public void setGoodlock(int goodlock) {
		this.goodlock = goodlock;
	}
	// 克隆对象
	@Override
	public Object clone() {
		Goodstable goods = null;
		try {
			goods = (Goodstable) super.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return goods;
	}
    public Integer getQhv() {
        return qhv;
    }
    public void setQhv(Integer qhv) {
        this.qhv = qhv;
    }
    public Integer getQht() {
        return qht;
    }
    public void setQht(Integer qht) {
        this.qht = qht;
    }

	public int getGoodTimeLock() {
		return goodTimeLock;
	}

	public void setGoodTimeLock(int goodTimeLock) {
		this.goodTimeLock = goodTimeLock;
	}

	public Long getGoodTimeLockDuration() {
		return goodTimeLockDuration;
	}

	public void setGoodTimeLockDuration(Long goodTimeLockDuration) {
		this.goodTimeLockDuration = goodTimeLockDuration;
	}

	private Integer equipIndex;
	public Integer getEquipIndex() {
		return equipIndex;
	}
	public void setEquipIndex(Integer equipIndex) {
		this.equipIndex = equipIndex;
	}

	public Map<BigDecimal, Goodstable> getEwMap() {
		return ewMap;
	}

	public void setEwMap(Map<BigDecimal, Goodstable> ewMap) {
		this.ewMap = ewMap;
	}
	public int getSbjljd() {
		return sbjljd;
	}
	public void setSbjljd(int sbjljd) {
		this.sbjljd = sbjljd;
	}
	public String getFysh() {
		return fysh;
	}
	public void setFysh(String fysh) {
		this.fysh = fysh;
	}
}